1. Field
The exemplary embodiments relate to an apparatus and method for recovering a cursor position, and more particularly, to an apparatus and method for quickly recovering a cursor position by using a small number of memory accesses.
2. Description of the Related Art
With the trends of fabrication of large-capacity storage devices and the proliferation of digital devices using the same, the amount of content stored in and managed by digital devices is rapidly increasing.
In recent years, not only folder-browse-based user interfaces (UIs) but also content-search-based UIs have been widely adopted, allowing users of digital devices to effectively utilize a large amount of content.
To implement a content-search-based UI, a digital device needs to be capable of managing and retrieving metadata for content stored in the digital device. Accordingly, more recently, there has been a growing trend toward portable digital devices employing a DBMS (Database Management System) having data management and storage capabilities.
The DBMS is a program that allows a plurality of users to record data in a database or to access the database to retrieve information stored in the database by providing environments in which convenient data storage and efficient data management can be achieved. In addition, the DBMS integrates remote data by application program, so that each application program can share the integrated data, enabling systematic utilization of information.
The DBMS performs defining of a collected data structure, gathering data according to data structure, data retrieval and renewal using database languages, simultaneous execution control of data processing by multiple users, returning to the original state in the event of an abnormality occurring while renewing data, management of information security, and so on. A typical DBMS is a Relational Database Management System (RDBMS) that uses a Structured Query Language (SQL) interface.
In the case of a portable digital device having an embedded DBMS performing the above-described functions, users of the portable digital device have requested the capability of recovering a final display in the event of a power interruption.
In a general final-display-recovery process, as a portable digital device is supplied with power, a bootloader is executed to drive an operation system. Once the operation system is driven, data acquisition for outputting a display is performed, and then data is output through a display device. Here, the operations of power supply, driving the operating system, execution of the bootloader, and display outputting are performed irrespective of the amount of data (e.g., common content like music, moving images, or images) stored in the digital device. However, in the data acquisition operation, data required for screen display is acquired by allowing the embedded DBMS to execute queries. In the case where the queries for data acquisition are inappropriately processed, the amount of content (target queries) increases, so that a query processing time may linearly increase.
That is, in the case of data acquisition for final data recovery, a query-processing time increases as the number of records provided as query processing results increases and a cursor is located at a later one of the query processing results.
In a portable digital device having an embedded DBMS that operates normally, predetermined queries are generated for data acquisition so that query processing is performed by the DBMS. Query processing results are accessed by cursor objects. Thus, acquiring data from the normally-operating DBMS means acquiring cursor objects for display output responding to a user input.
That is, in a portable digital device in which power is frequently turned on/off, recovering a final display means recovering a search position of a database when the database search is terminated because a cursor start position when the portable digital device is restarted corresponds to the search position when the database search is terminated.
One approach for recovering a search position is to re-execute a query such that the cursor position is stored by storing query strings. Then, the stored query strings are loaded when recovering the cursor position, thereby creating the cursor. Once the cursor is created, the cursor position is moved sequentially while determining whether the position of the cursor created by loading the query strings is identical with a position of the cursor currently in use, thereby recovering the search position.
Such a search-position-recovery scheme may, however, impose several problems. For example, performance degradation due to cursor position movement may be caused as the stored cursor position becomes distant from the current cursor position. Further, as the amount of content of the target queries increases, the recovery time may increase.
Another approach for recovering a search position is to store query results in a disk prior to power interruption of a portable digital device, and recycle the stored query results when restarting the portable digital device. In the related art, query strings are stored when storing a cursor and a current cursor position is temporarily stored.
For storage of all search results, the cursor is moved to the first cursor position, and search results corresponding to query strings are stored while moving the cursor until the last search result is reached. Once the storage of all search results is completed, the cursor is moved to the current cursor position that is temporarily stored.
Thereafter, when restarting the portable digital device, the search position recovery is performed by loading pre-stored search results stored according to the cursor search results before the cursor is created, and searching for the cursor position based on the loaded search results.
However, this is disadvantageous in that considerable search result storage costs may be involved in a search position storage stage. In order to store all search results in the search position storage stage, data of fields selected while the current cursor is moved throughout all the search results from the first to the last search results should be stored in a separate space. That is, recovery performance is liable to degrade according to the number of times the cursor is moved, the size of data stored, the number of search results, the number of fields selected, and so on.
That is, according to the related art, cursor position storage for final-display recovery and a search position recovery scheme using a re-search method in a search position recovery stage may cause performance degradation due to an increase in the number of times the cursor is moved. Accordingly, as the stored cursor position becomes distant from the first search result, the recovery performance in the search position recovery stage may become very poor. In addition, it is highly probable that the search-position-recovery performance may degrade as the amount of content as target queries.
Still another approach for recovering a search position is to store search results, which also entails several disadvantages. That is, degradation of recovery performance may be caused due to the size of stored data. In addition, an increased number of search results may increase the number of fields selected, which causes an increase in the amount of data stored, unavoidably degrading the performance in the search-position-recovery stage.
The related art search position recovery schemes render severe degradation in the performance in a search position recovery stage (using a re-search method) or a search position storage stage (using stored search results). Accordingly, a methodology is needed for recovering a search position without performance degradation.